package com.chuanshiyidao.huawei;

import android.content.Context;
import android.content.SharedPreferences;

public class SpUtils {

    private static String PREFS_NAME = "GAME_CHUANQI99";
    private static String GUEST_KEY = "GUEST_KEY";
    private static String BIND = "BIND";//是否已经绑定过

    public static void addGuestKey(Context context, String value) {
        SharedPreferences pre = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
        SharedPreferences.Editor ed = pre.edit();
        ed.putString(GUEST_KEY, value);
        ed.apply();
    }

    public static String  getGuestKey(Context context){
        SharedPreferences pre = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
        return pre.getString(GUEST_KEY, "");
    }


    public static void addHasBind(Context context) {
        SharedPreferences pre = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
        SharedPreferences.Editor ed = pre.edit();
        ed.putBoolean(BIND, true);
        ed.apply();
    }

    public static boolean getHasBind(Context context) {
        SharedPreferences pre = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
        return pre.getBoolean(BIND, false);
    }
}
